package ${packageName}.${entity.moduleName}.service.impl;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import cn.sofwin.core.mvc.annotation.BaseDao;
import cn.sofwin.core.mvc.service.impl.BaseServiceImpl;
import cn.sofwin.core.mvc.bean.info.Module;
import ${packageName}.${entity.moduleName}.entity.${entityName};
import ${packageName}.${entity.moduleName}.service.${entityName}Service;
import ${packageName}.${entity.moduleName}.dao.${entityName}Dao;

/**
 * ${entity.entityComment}服务层
 * @author ${author}
 * @version ${version}
 * @date ${date}
 *
 */
@CacheConfig(cacheNames = "${entity.moduleName}_${entityNameLower}")
@Service("${entityNameLower}Service")
public class ${entityName}ServiceImpl extends BaseServiceImpl<${entityName}> implements ${entityName}Service {
	
	@BaseDao
	${entityName}Dao ${entityNameLower}Dao;


	@Cacheable
	@Override
	public Module loadModuleInfo(){
		Module module = new Module("${entity.entityComment}", "${entityNameLower}");

		// 增加表头字段信息
		module.addColumn("id", "序号")
		<#list entity.fields as field>
		      .addColumn("${field.fieldName}", "${field.comment}")<#if (!field_has_next)>;</#if>
		</#list>

		// 增加搜索字段信息
		module.addSearchField("title", "名称");

		// 增加视图地址
		module.addView("list", "/home/list/${entityNameLower}")
		      .addView("form", "/home/form/${entityNameLower}");

		// 增加数据请求接口
		module.addApi("base", "/${entity.moduleName}/${entityNameLower}");

		return module;
	}
	
	
	
}